package java101;

public class GeoPoint2 {

		 double lat;
		 double lon;

		  public GeoPoint2(double degLatitude, double degLongitude) {

		    if ((degLatitude > 90. || degLatitude < -90.) || (degLongitude > 180. || degLongitude < -180.))

		      throw new IllegalArgumentException("GeoPoint out of range");

		    this.lat = toRadians(degLatitude);
		    this.lon = toRadians(degLongitude);
		  }

		  public GeoPoint2(int deg, int min, double sec) {

		    this(deg + min / 60. + sec / 3600., 0);
		  }

		  private static double toRadians(double degGeoPoint) {

		    return degGeoPoint * Math.PI / 180.;
		  }
		  
		  public double getDegLat() {

		    return this.lat * 180. / Math.PI;
		  }

		  public double getLat() {

		    return lat;
		  }
		  public double getDegLon() {

			    return this.lon * 180. / Math.PI;
			  }

			  public double getLon() {

			    return lon;
			  }

	}
